<?php

include_once 'Expression.php';
include_once 'ExpressionCollection.php';
include_once 'FunctionReferenceExpression.php';

class FunctionInvokeExpression extends Expression
{
    public function __construct(
        FunctionReferenceExpression $Function, ExpressionCollection $Parameters = null)
    {
        parent::__construct();
        $this->set_Function($Function);
        
        $Parameters == null ? 
            $this->Parameters = new ExpressionCollection() :
            $this->set_Parameters($Parameters);
    }
    
    public function __set($name, $value)
    {
        parent::__set($name, $value);
        
        if($name == 'Function')
        {
            $this->set_Function($value);
        }
        
        if($name == 'Parameters')
        {
            $this->set_Parameters($value);
        }
    }
    
    public function __get($name)
    {
        $ret = parent::__get($name);
        
        if($ret != null)
        {
            return $ret;
        }
        
        if($name == 'Function')
        {
            return $this->get_Function();
        }
        
        if($name == "Parameters")
        {
            return $this->get_Parameters();
        }
    }
    
    public function get_Function()
    {
        return $this->Function;
    }

    public function set_Function(FunctionReferenceExpression $Function)
    {
        $this->Function = $Function;
    }
    
    public function get_Parameters()
    {
        return $this->Parameters;
    }

    public function set_Parameters(ExpressionCollection $Parameters = null)
    {
        $this->Parameters = $Parameters;
    }
    
    private $Function;
    private $Parameters;
}

?>
